import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 客户管理-服务单元-内部小组信息 */
export interface CustomerArchiveServiceUnitTeam {
  id: number // id
  name: string // 小组名称
  serviceUnitId: number // 所属服务单元id
  serviceUnitName: number // 所属服务单元名称
  membersId: string // 组员id
  membersName: string // 组员名称
  ownerUserId: number // 负责人id
}

// 客户管理-服务单元-内部小组 API
export const CustomerArchiveServiceUnitTeamApi = {
  // 查询客户管理-服务单元-内部小组分页
  getCustomerArchiveServiceUnitTeamPage: async (params: any) => {
    return await request.get({ url: `/san/biz-customer-archive-service-unit-team/page`, params })
  },

  // 查询客户管理-服务单元-内部小组详情
  getCustomerArchiveServiceUnitTeam: async (id: number) => {
    return await request.get({ url: `/san/biz-customer-archive-service-unit-team/get?id=` + id })
  },

  // 新增客户管理-服务单元-内部小组
  createCustomerArchiveServiceUnitTeam: async (data: CustomerArchiveServiceUnitTeam) => {
    return await request.post({ url: `/san/biz-customer-archive-service-unit-team/create`, data })
  },

  // 修改客户管理-服务单元-内部小组
  updateCustomerArchiveServiceUnitTeam: async (data: CustomerArchiveServiceUnitTeam) => {
    return await request.put({ url: `/san/biz-customer-archive-service-unit-team/update`, data })
  },

  // 删除客户管理-服务单元-内部小组
  deleteCustomerArchiveServiceUnitTeam: async (id: number) => {
    return await request.delete({
      url: `/san/biz-customer-archive-service-unit-team/delete?id=` + id
    })
  },

  /** 批量删除客户管理-服务单元-内部小组 */
  deleteCustomerArchiveServiceUnitTeamList: async (ids: number[]) => {
    return await request.delete({
      url: `/san/biz-customer-archive-service-unit-team/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出客户管理-服务单元-内部小组 Excel
  exportCustomerArchiveServiceUnitTeam: async (params) => {
    return await request.download({
      url: `/san/biz-customer-archive-service-unit-team/export-excel`,
      params
    })
  }
}
